import {
  CommonI,
  IndividualI,
  RoleI,
  UploadedFileI,
  WeixinOauthI,
} from "./system";
import { Dayjs } from "dayjs";

export interface WeixinOauthReqI {
  code: string;
  state: string;
}

export interface CellphoneRegisterReqI {
  cellphone: string;
  verifyCode: string;
  oauth: WeixinOauthI;
}

export interface VerifyCodeReqI {
  cellphone: string;
  captchaID?: string;
  vcode?: string;
}

export interface CaptchaI {
  captchaID: string;
  imageUrl: string;
}

export interface LoginReqI {
  username: string;
  password: string;
  // vcode: string;
  // captchaID: string;
}

export interface ChangePasswordReqI {
  id: string;
  oldPassword: string;
  newPassword: string;
  newPasswordAgain: string;
}

export interface RegisterReqI {
  username: string;
  password: string;
  password1: string;
  full_name?: string;
  role?: RoleI;
  is_superuser?: boolean;
}

// 每日统计结果
export interface VbpDayStatsI extends CommonI {
  statsDate: Date;
  atcCode: string;
  vbpClass: string;
  monitorClass: string;
  hisCode: string;
  drugname: string;
  cadn: string;
  batch: string;
  manuName: string;
  deptYbName: string;
  priceSum: number;
  amountSum: number;
  amountUnit: string;
}

// 集采中选药品完成情况
export interface VbpStatsByHisCodeI {
  hisCode: string;
  drugname: string;
  startDate: Date;
  endDate: Date;
  dutyAmount: number;
  amountSum: number;
  percent: number;
}

// 按日期展示各药品使用情况
export interface VbpStatsByStatsDateI {
  statsDate: string;
  hisCode: string;
  drugname: string;
  startDate: Date;
  endDate: Date;
  percent: number;
}

// 集采相关药品完成情况
export interface VbpStatsByCadnI {
  cadn: string;
  monitorClass: string;
  deptYbName?: string;
  endDate: string | Date;
  percent: number;
  startDate: string | Date;
  vbpClass: string;
}

// 科室集采相关药品完成情况
export interface VbpStatsByDeptI {
  cadn: string;
  deptYbName: string;
  startDate: string | Date;
  endDate: string | Date;
  vbpClass: string;
  amountSum: number;
  percent: number;
}

export interface VbpBatchI extends CommonI {
  hisCode: string;
  startDate: Date;
  endDate: Date;
  atcCode: string;
  vbpClass: string;
  monitorClass: string;
  drugname: string;
  specification: string;
  miniUnit: string;
  packSize: number;
  packUnit: string;
  pinyin?: string;
  py?: string;
  manuName: string;
  dutyAmount: number;
  batch?: string;
  cadn: string;
  calcFactor: number;
  status: number;
}

export interface VbpDeptDutyPreviewI extends CommonI {
  vbpBatchId: string;
  vbpBatch?: VbpBatchI;
  hisCode: string;
  drugname: string;
  deptYbName: string;
  deptAmountSum: number;
  totalAmountSum: number;
  totalDutyAmount: number;
  deptDutyAmount: number;
}

export interface VbpDeptDutyI extends CommonI {
  vbpBatchId: string;
  vbpBatch?: VbpBatchI;
  deptYbName: string;
  pinyin?: string;
  py?: string;
  dutyAmount: number;
}

export interface VbpDeptDutyStatsI extends CommonI {
  vbpBatchId: string;
  deptYbName: string;
  deptDutyAmount: number;
  hisCode: string;
  drugname: string;
  specification: string;
  startDate: string;
  endDate: string;
  dutyAmount: number;
  completed: number;
  completedPercent: number;
  manuName: string;
  cadn: string;
  miniUnit: string;
}

export interface HisMedicineI extends CommonI {
  /**
   * HIS库中的药品字典，用于日常查询HIS字典状态
   */
  chargeCode: string; // HIS药品码
  serial: string; // HIS药品规格码
  atcCode?: string; // CFDA链接
  drugname: string; // 药品名称
  drugType?: string; // 药品大类
  pinyin: string; // 药品名称全拼
  py: string; // 药品名称拼音字头
  specification: string; // 药品包装规格
  miniUnit?: string; // 药品最小包装单位代码
  packSize: number; // 包装大小
  cadn?: string; // 药品通用名
  commercialName?: string; // 药品商品名
  retailPrice: number; // 零售价, check:retail_price>0
  mzChargeType?: string; // 门诊费用类别
  zyChargeType?: string; // 住院费用类别
  manufacture?: string; // 药品生产商
  cfdalink?: string; // CFDA链接
  deletedFlag?: number; // 字典删除标志
  mzOpenFlag?: number; // 门诊药房是否开放
  showFlag?: number; // 是否展示标志
  startDate: string; // 开始日期
  endDate?: string; // 结束日期
  monitorClass?: string; // 监控分类
  dutyAmount: number; // 任务量, check:duty_amount>=0
  batch: number; // 批次
  uploadedFiles?: UploadedFileI[];
}

export interface MedicineDocI extends CommonI {
  title: string;
  showFlag: boolean;
}

export interface AccessLogStatsI {
  statsDate: Date;
  username: string;
  fullName: string;
  accessCount: number;
}
